-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adds new configuration options to add custom tags (labels) to logs #2743
base: main
Are you sure you want to change the base?
feat: Adds new configuration options to add custom tags (labels) to logs #2743
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2743 +/- ##
==========================================
- Coverage 97.25% 97.21% -0.05%
==========================================
Files 294 294
Lines 46233 46267 +34
==========================================
+ Hits 44965 44977 +12
- Misses 1268 1290 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
lib/aggregators/log-aggregator.js
Outdated
{ | ||
common: { attributes: commonAttrs }, | ||
logs: formattedLogs | ||
} | ||
] | ||
|
||
// exclude list needs to be case-insensitive | ||
const excludeSet = new Set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand this conversion of array to set. Cant you just lower case all the keys at initialization of the config option then just do an array.includes check in here?
lib/aggregators/log-aggregator.js
Outdated
if (isLogLabelingEnabled(this.agent.config)) { | ||
const configuredLabels = parseLabels(this.agent.config.labels) | ||
|
||
configuredLabels.forEach((label) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to encapsulate this into another logging helper function that just returns an object that can be assigned to the common attributes section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also prob do this in lib/config/index.js
to reconcile what's the labels to keep as this is static
Description
How to Test
Run unit tests.
Related Issues
Closes #2716
TODO